package netty.rpc.framework.rpcserver.service.impl;

import lombok.extern.slf4j.Slf4j;
import netty.rpc.framework.api.model.User;
import netty.rpc.framework.api.service.UserService;
import netty.rpc.framework.core.netty.annotation.RPCService;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Slf4j
@RPCService
public class UserServiceImpl implements UserService {
    @Override
    public void sayHello(String name) {
         log.info("hello +{}",name);
    }

    @Override
    public void sayHello(User user) {
        log.info("hello +{}",user.toString());
    }

    @Override
    public User getUser(Integer id) {
        if(id > 0){
            HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
            objectObjectHashMap.put("hello","world");
            return new User("hello",231,objectObjectHashMap);
        }
        return null;

    }


}
